﻿<Window x:Class="Epi.WPF.Dashboard.Dialogs.ExportWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:EpiDashboard="clr-namespace:Epi.WPF.Dashboard"
             xmlns:Controls="clr-namespace:Epi.WPF.Dashboard.Controls"
             mc:Ignorable="d"
        Width="500" Height="Auto"        
        WindowStyle="SingleBorderWindow"
        SizeToContent="Height"
        ResizeMode="NoResize"        
        Title="Export data"
        ShowInTaskbar="False"
        SnapsToDevicePixels="True"        
        FontSize="14" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid x:Uid="Grid_1" x:Name="ConfigGrid" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="5,5,5,5" >
        <StackPanel Margin="5" HorizontalAlignment="Stretch" VerticalAlignment="Top" >                    

            <TextBlock Visibility="Collapsed" Text="This gadget will export the current set of records to one of the available formats below. To proceed, first select an output format. Then click the ... button next to Connection Information to specify a database. Finally, select a table or spreadsheet from within the database." TextWrapping="WrapWithOverflow" HorizontalAlignment="Left" Margin="0, 0, 0, 10" />

            <TextBlock x:Name="tblockOutputFormat" Text="Output format" ></TextBlock>
            <ComboBox x:Name="cmbDataFormats" Margin="0,0,0,8" MinWidth="445"></ComboBox>

            <TextBlock x:Name="tblockConnInfo" Text="Connection information" ></TextBlock>
            <Grid x:Uid="Grid_2" Name="grdConnectionInformation" Margin="0,0,0,8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="5"></ColumnDefinition>
                    <ColumnDefinition Width="26"></ColumnDefinition>
                </Grid.ColumnDefinitions>                
                
                <TextBox x:Name="txtConnectionInformation" Grid.Row="0" Grid.Column="0" IsEnabled="False" HorizontalAlignment="Stretch" TextChanged="txtConnectionInformation_TextChanged" />                
                <Button x:Name="btnConnectionBrowse" Content="..." Grid.Row="0" Grid.Column="2" Click="btnConnectionBrowse_Click" />
            </Grid>

            <TextBlock x:Name="tblockDestinationTable"  Text="Destination table" ></TextBlock>
            <ComboBox x:Name="cmbDestinationTable" IsEditable="True"  Margin="0,0,0,8" SelectionChanged="cmbDestinationTable_SelectionChanged" TextInput="cmbDestinationTable_TextInput" KeyDown="cmbDestinationTable_KeyDown" KeyUp="cmbDestinationTable_KeyUp"></ComboBox>

            <TextBlock  x:Name="tblockFields" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,0" Text="Fields to export:" TextAlignment="Center" />
            <ListBox HorizontalAlignment="Stretch" Margin="0,0,0,8" Name="lbxExportFields" SelectedIndex="0" SelectionMode="Extended" Width="Auto" Height="225" />
            <TextBlock x:Name="tblockFieldCount" Text="0 fields selected" FontSize="10" Margin="0,0,0,12"></TextBlock>
            <CheckBox x:Name="checkboxTabOrder" Content="Sort variables by tab order" Visibility="Visible" IsEnabled="true" Margin="0,0,0,8"  />
            <CheckBox x:Name="checkboxUsePrompts" Content="Use field prompts" Visibility="Collapsed" IsEnabled="true" Margin="0,0,0,8"  />

            <Controls:GadgetMessagePanel x:Name="messagePanel" HasProgressBar="True" Text="Export status" Visibility="Collapsed" Margin="0,0,0,10">                
            </Controls:GadgetMessagePanel>

            <UniformGrid Columns="3">
                <StackPanel Grid.Column="0" />
                <Button x:Name="btnExport" Content="Export" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Margin="4" Click="btnExport_Click" />
                <Button x:Name="btnCancel" Content="Close" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch" Margin="4" IsCancel="True" Click="btnCancel_Click" />
            </UniformGrid>            
        </StackPanel>
    </Grid>
</Window>
